package com.example.demo.mapper;

import com.example.demo.entity.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface querymanageMapper {
    @Insert("insert into view_querymanage(fkey,fname,ftime,upower,tpower) value(#{fkey},#{fname},#{ftime},#{upower},#{tpower})")
    public int insert(querymanage querymanage);

    @Update("update view_querymanage set ploss=#{ploss} where fkey=#{fkey}")
    public int updatePloss(int fkey, double ploss);

    @Select("select * from view_querymanage where fkey=#{fkey}")
    public querymanage selectFtime(int fkey);

    @Update("update view_querymanage set rtime=#{rtime} where fkey=#{fkey}")
    public int updateRtime(int fkey, String rtime);

    @Select("select * from fnameview where fname=#{fname}")
    public List<fnameview> selectFname(fnameview fnameview);

    @Select("select upower,tpower,estatus from view_basicdata where wfkey=#{wfkey} and ukey=#{ukey}")
    public basicquery basicquery(deletebasic deletebasic);

    @Select("select count(newkey) as parts from view_newpartsmanage where wfkey=#{wfkey} and ukey=#{ukey} and dtime is not null")
    public int partsquery(deletebasic deletebasic);
    @Select("select s.fcode,s.fname,count(f.fkey) as num  from fault s,view_faultmanage f where " +
            "s.fcode=f.fcode group by s.fcode")
    public List<faultnum> faultnumquery();
}
